package com.example.testfadetopchatlist;

import android.content.Context;
import android.util.DisplayMetrics;
import android.util.Log;

import androidx.recyclerview.widget.LinearSmoothScroller;

public class MyLinearSmoothScroller extends LinearSmoothScroller {
public static final String TAG = "MyLinearSmoothScroller";
    public MyLinearSmoothScroller(Context context) {
        super(context);
    }

    private int speedRadio = 1;

    public void setSpeedRadio(int radio) {
        if (radio <= 0) {
            this.speedRadio = 1;
        }else if (radio >= 30){
            this.speedRadio = 30;
        }else {
            this.speedRadio = radio;
        }
    }


    @Override
    protected float calculateSpeedPerPixel(DisplayMetrics displayMetrics) {
        float speed = super.calculateSpeedPerPixel(displayMetrics) * 10;
        Log.d(TAG, "calculateSpeedPerPixel :: speed = " + speed);
        return speed;
    }
}
